package com.yanqu.road.server.cmd.unioncampwar.cross;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.unionCampWar.UnionCampWar;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.unioncampwar.UnionCampWarModule;
import com.yanqu.road.server.manger.player.GamePlayerMgr;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameProtocol;


@Cmd(code = GameProtocol.S_UNION_CAMP_WAR_BATTLE_NOTICE_ADD, desc = "商帮新增公告广播")
public class CrossUnionCampNoticeAddCmd extends AbstractCommand {
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        UnionCampWar.UnionCampWarBattleNoticeAddMsg respMsg = UnionCampWar.UnionCampWarBattleNoticeAddMsg.parseFrom(packet.getBytes());
        UnionCampWar.UnionCampWarBattleNoticeAddMsg.Builder builder = respMsg.toBuilder();
        for (GamePlayer gamePlayer : GamePlayerMgr.getAllOnlinePlayer()) {
            gamePlayer.sendPacket(ClientProtocol.U_UNION_CAMP_WAR_BATTLE_NOTICE_ADD, builder);
        }

    }

    @Override
    public void sendData(GamePlayer player) {
        if (null == player) {
            return;
        }

    }
}
